﻿using System;

namespace SSC.PlcConnect
{
    public static class PlcFactory
    {
        public static IPlcConnect CreatePlcConnection(PlcType plcType, string ipAddress, int port)
        {
            switch (plcType)
            {
                case PlcType.Siemens:
                    SiemensPlc.Initialize(ipAddress, port);
                    return SiemensPlc.GetInstance();
                case PlcType.Mitsubishi:
                    MitsubishiPlc.Initialize(ipAddress, port);
                    return MitsubishiPlc.GetInstance();
                case PlcType.Omron:
                    OmronPlc.Initialize(ipAddress, port);
                    return OmronPlc.GetInstance();
                default:
                    throw new ArgumentException("Unsupported PLC type");
            }
        }
    }
}
